// https://nuxt.com/docs/api/configuration/nuxt-config
import { resolve, dirname } from 'node:path';
import { fileURLToPath } from 'url';
import {loadEnv} from "vite";
const { VITE_PROXY_URL } = process.env
export default defineNuxtConfig({
  devtools: { enabled: true },
  ssr:true,
  sourcemap:process.env.NODE_ENV==='development',
  //   页面过度
  app: {
    pageTransition: { name: 'app', mode: 'out-in' },
    // 布局过渡
    layoutTransition: { name: 'layout', mode: 'out-in' },
    head: {
      charset: 'utf-8',
      viewport: 'width=device-width, initial-scale=1',
      // meta: [{ name: 'referrer', content: 'no-referrer' }],
      link:[
        {
          href:'/css/swiper-bundle.min.css'
        }
      ],
      script: [
        {
          src: '/js/rem.js',
        }, {
          src: '/js/jquery.min.js',
        },
        {
          src: '/js/swiper-bundle.min.js',
        }
      ],
      title: '执象广告|中国互联网营销服务商|微博|粉丝通|抖音|爱奇艺|头条',
      meta: [
        { name: 'description', content: '执象广告,微博,粉丝通,抖音,爱奇艺,头条,中国互联网营销服务商' },
        { name: 'keywords', content: '执象广告,微博,粉丝通,抖音,爱奇艺,头条,中国互联网营销服务商' }
      ],
    },
  },
  // 模块配置
  modules: [
    '@nuxtjs/sitemap',
    '@element-plus/nuxt',
    '@pinia/nuxt', 'nuxt3-aos',
    '@pinia-plugin-persistedstate/nuxt', 'nuxt-swiper'],
  // 反向代理
  nitro: {
    devProxy: {
      '/prod-api/api': {
        target:  VITE_PROXY_URL+'api',
        changeOrigin: true,
        prependPath: true
      },
      '/profile': {
        target:  VITE_PROXY_URL+'profile',
        changeOrigin: true,
        prependPath: true
      },
      '/prod-api/profile': {
        target:  VITE_PROXY_URL+'profile',
        changeOrigin: true,
        prependPath: true
      }
    },
    // 该配置用于服务端请求转发
    routeRules: {
      '/prod-api/api/**': {
        proxy:  VITE_PROXY_URL+'api/**'
      },
      '/profile/**': {
        proxy:  VITE_PROXY_URL+'profile/**'
      },
      '/prod-api/profile/**': {
        proxy:  VITE_PROXY_URL+'profile/**'
      },
    }
  },
  build: {
    transpile: [],
    analyze: {}
  },
  vite: {
    resolve: {
      alias: {

      }
    },
    plugins: []
  },
  sitemap:{

  },
  site:{
    url:'http://zxmember.com'
  }
});
